﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace RFEngine.Graphics
{
    public sealed class TexturedQuadCollection : List<TexturedQuad>
    {
        #region Fields

        private List<SpriteVertex> _Verticies = new List<SpriteVertex>();

        #endregion

        #region Properties

        /// <summary>
        /// Gets the vertices for drawing, for the entire collection
        /// </summary>
        public SpriteVertex[] VerticesForDrawing
        {
            get
            {
                if (Count == 0)
                    return null;

                _Verticies.Clear();

                for (int collectionIndex = 0; collectionIndex < base.Count; collectionIndex++)
                {
                    for (int vertex = 0; vertex < base[collectionIndex].VerticesForDrawing.Length; vertex++)
                    {
                        _Verticies.Add(base[collectionIndex].VerticesForDrawing[vertex]);
                    }
                }

                return _Verticies.ToArray();
            }
        }

        #endregion

        /// <summary>
        /// Constructs a new instance of this object.
        /// </summary>
        /// <param name="capacity">The initial capacity to use when contructing this instance</param>
        public TexturedQuadCollection(int capacity)
            : base(capacity) { }

    }
}
